package cn.zzxy.day01;
import java.sql.*;
/**
 * 练习：用DBUtils去查询emp表中的ename和job，sal，comm
 * 并输出
 */
public class Demo6 {
    public static void main(String[] args) throws Exception{
        Connection conn = DBUtils.getConn();
        Statement st = conn.createStatement();
        String sql = "select ename,job,sal,comm from emp";
        ResultSet rs = st.executeQuery(sql);
        while (rs.next()){
            String name = rs.getString("ename");
            String job = rs.getString("job");
            String sal = rs.getString(3);
            String comm = rs.getString(4);
            System.out.println("员工"+name+"的工作是："
                    +job+",他的工资是："+sal+"元，奖金是："+comm+"元");
        }
        conn.close();
    }
}
